package com.shenzhen.horselive.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.shenzhen.horselive.ui.fragment.HongBaoFragment;
import com.shenzhen.horselive.ui.fragment.LianTongTestFragment;
import com.shenzhen.horselive.ui.fragment.MeFragment;
import com.shenzhen.horselive.ui.fragment.WealthFragment;

import java.util.List;

public class HomeViewPageAdapter extends FragmentPagerAdapter {
   List<String>   strings;
    public HomeViewPageAdapter(@NonNull FragmentManager fm, int behavior) {
        super(fm, behavior);
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
      if (position==0)
      {
          return LianTongTestFragment.newInstance();
      }else if (position==1)
      {
          return HongBaoFragment.newInstance();
      }
      else if (position==2)
      {
          return WealthFragment.newInstance();
      }else
      {
          return MeFragment.newInstance();
      }


    }

    @Override
    public int getCount() {
        return 4;
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        if (strings!=null)
        return strings.get(position);
        else
            return super.getPageTitle(position);
    }
}
